
%clearfix {
	&:after,
	&:before {
		content: "";
		display: table;
	}

	&:after {
		clear: both;
	}
}
//图片居中
%imageCenter {
	text-align: center;
	display: table-cell;
	vertical-align: middle;

	img {
		display: inline-block;
	}
}
//固定定位居中
%centerMiddle {
	position: fixed;
	top: 50%;
	left: 50%;
	-webkit-transform: translate(-50%,-50%);
	transform: translate(-50%,-50%);
}
//绝对定位居中
%middle {
	position: absolute;
	top: 50%;
	left: 50%;
	-webkit-transform: translate(-50%,-50%);
	transform: translate(-50%,-50%);
}
//两端对齐
%justify {
	text-align: justify;
	text-align-last: justif;

	&:after {
		content: '';
		display: inline-block;
		width: 100%;
	}
}
//单行文字...
%ellipsis {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

%btnHover {
	background-color: $mainColor;
	color: #fff;
	transition: all 0.3s;
	&:hover{
		background-color: #028a48;
		transition: all 0.3s;
	}
}
//背景缩放
%cover {
	background-repeat: no-repeat;
	background-size: cover;
	background-position: center center;
}
//经过边框 投影
%border {
	background-color: #fff;
	border-radius: 5px;
	box-shadow: 0 4px 25px 0 rgba(0,0,0,.1);
	transition: all 0.3s;

	&:hover {
		transition: all 0.3s;
		box-shadow: 0 4px 25px 0 rgba(0,0,0,.3);
	}
}
//通栏广告
%bannerAdv {
	width: ($minWidth+10px);
	margin: 0 auto;
	overflow: hidden;

	ul {
		width: ($minWidth+10px);
		display: inline;
		float: left;

		li {
			display: block;
			float: left;
			padding: $divPadding 5px 0;
			position: relative;

			a {
				float: left;
			}
		}
	}
}
//矢量背景图
%image {
	background: #f2f2f2 url("https://public.mtnets.com/Images/Public/picture.svg") no-repeat  center center;
	background-size: 40% 40%;
}
//移动端1px 边框
@mixin border-1px($border-width: 1px, $border-color:$borderColor, $border-style: solid ) {
	position: relative;

	&::after {
		position: absolute;
		content: "";
		top: -50%;
		bottom: -50%;
		left: -50%;
		right: -50%;
		-webkit-transform: scale(0.5);
		transform: scale(0.5);
        border-bottom: $border-width $border-style $border-color;
	}

	@media (-webkit-min-device-pixel-radio: 3), (min-device-pixel-radio: 3) {
	    &::after {
	        -webkit-transform: scaleY(0.33333333);
	        transform: scaleY(0.33333333);
	    }
	}

	@media (-webkit-min-device-pixel-radio: 2), (min-device-pixel-radio: 2) {
	    &::after {
	        -webkit-transform: scaleY(0.5);
	        transform: scaleY(0.5);
	    }
	}
}

//图片居中
@mixin imgCenter($width,$height) {
	display: table-cell;
	vertical-align: middle;
	text-align: center;
	*display: block;
	*font-size: round(($height/100px) * 87.5px);
	*font-family: Arial;
	width: $width;
	height: $height;

	img {
		vertical-align: middle;
		max-width: $width;
		max-height: $height;
	}
}
//响应式图片
@mixin responsiveImg($width,$height,$float) {
	@if $float == left {
		width: $width;
		overflow: hidden;
		float: left;
	}

	.itemImg {
		height: 0;
		padding-bottom: ($height/$width)*100%;
		position: relative;
		overflow: hidden;

		img {
			width: 100%;
			max-height: none;
			display: block;
		}
	}
}
//固定尺寸的绝对定位居中
@mixin positionAb($x , $y) {
	position: absolute;
	left: 50%;
	top: 50%;
	width: $x;
	height: $y;
	margin-left: -$x/2;
	margin-top: -$y/2;
	z-index: 99;
}
//外发光
@mixin outerGlow($size,$opacity) {
	box-shadow: 0 0 $size rgba(0, 0, 0, $opacity);
}
@mixin browser($property, $value) {
	@each $prefix in -webkit-, -moz-, -ms-, -o-,'' {
		#{$prefix}#{$property}: $value;
	}
}
//透明度
@mixin opacity($opacity) {
	opacity: $opacity;
	$opacity-ie: $opacity * 100;
	@if $filter {
		filter: alpha(opacity=$opacity);
	}
}
//水平居中
@mixin blockCenter($top) {
	margin: $top auto 0;
}
//链接
@mixin linkColor($color1, $color2) {
	color: $color1;

	&:hover {
		color: $color2;
		text-decoration: underline;
	}
}
//固定尺寸的固定居中
@mixin fixed($x, $y) {
	position: fixed;
	left: 50%;
	top: 50%;
	width: $x;
	height: $y;
	margin-left: -$x/2;
	margin-top: -$y/2;
	z-index: 99;
}
//渐变
@mixin background-gradient($startColor, $endColor,$startAngle) {//右左90  上下-180
	background-image: -webkit-gradient(linear, left top, left bottom, from($startColor), to($endColor));
	background-image: -webkit-linear-gradient($startAngle, $startColor, $endColor);
	background-image: -moz-linear-gradient($startAngle, $startColor, $endColor);
	background-image: -ms-linear-gradient($startAngle, $startColor, $endColor);
	background-image: -o-linear-gradient($startAngle, $startColor, $endColor);
	background-image: linear-gradient($startAngle, $startColor, $endColor);
    filter : progid:DXImageTransform.Microsoft.gradient(startColorStr='#{$startColor}', endColorStr='#{$endColor}');
}
//过渡
@mixin transition($time:0.3s,$fn:ease) {
	-webkit-transition: all $time $fn;
	-moz-transition: all $time $fn;
	-ms-transition: all $time $fn;
	-o-transition: all $time $fn;
	transition: all $time $fn;
}
//旋转
@mixin transform($degree) {
	-webkit-transform: rotate($degree);
	-ms-transform: rotate($degree);
	-o-transform: rotate($degree);
	transform: rotate($degree);
}
//正三角的通用属性

%triangleBase {
	_font-size: 0;
	_line-height: 0;
	_overflow: hidden;
	width: 0;
	height: 0;
}
//regulaTriangle:正三角(dashed默认透明)
//例子：@include regulaTriangle(top,red);
@mixin regulaTriangle($derection:bottom, $color: #000, $width: 20px) {
	@extend %triangleBase;
	border-width: $width;
	//向右
	@if $derection==right {
		border-style: dashed dashed dashed solid;
		border-color: transparent transparent transparent $color;
	}
	//向左
	@if $derection==left {
		border-style: dashed solid dashed dashed;
		border-color: transparent $color transparent transparent;
	}
	//向上
	@if $derection==top {
		border-style: dashed dashed solid dashed;
		border-color: transparent transparent $color transparent;
	}
	//向下
	@if $derection==bottom {
		border-style: solid dashed dashed dashed;
		border-color: $color transparent transparent transparent;
	}
}
//right-angledTriangle:直角三角形
//例子：@include right-angledTriangle(1,red);
@mixin right-angledTriangle ($derection:1, $color:#000, $width: 20px, $opacity:transparent, $border:dashed) {
	@extend %triangleBase;
	border-width: $width;
	//向右
	@if $derection==1 {
		border-style: $border dashed dashed $border;
		border-color: $color $opacity $opacity $color;
	}
	//向右
	@if $derection==2 {
		border-style: $border $border dashed dashed;
		border-color: $color $color $opacity $opacity;
	}
	//向右
	@if $derection==3 {
		border-style: dashed $border $border dashed;
		border-color: $opacity $color $color $opacity;
	}
	//向右
	@if $derection==4 {
		border-style: dashed dashed $border $border;
		border-color: $opacity $opacity $color $color;
	}
}
//百分比宽度
@function Width($num) {
	@return percentage(100%/$num);
}
//循环
@each $color in red, green, yellow, blue {
	.p_#{$color} {
		background-color: #{$color};
	}
}
@mixin font-dpr($font-size) {
	font-size: $font-size;

	[data-dpr="2"] & {
		font-size: $font-size * 2;
	}

	[data-dpr="3"] & {
		font-size: $font-size * 3;
	}
}
